{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        <!-- 温馨提示 -->
        {{if is_array(MyLang('power.top_tips_list'))}}
            <div class="am-operate-stretch-tips">
                <div class="title">
                    <i class="iconfont icon-tips"></i>
                    <strong title="{{:MyLang('operate_list_tips_msg')}}">{{:MyLang('operate_list_tips_button_text')}}</strong>
                    <i class="iconfont icon-contract contract" title="{{:MyLang('operate_list_tips_retract_text')}}"></i> 
                </div>
                <p>{{:implode('</p><p>', MyLang('power.top_tips_list'))}}</p>
            </div>
        {{/if}}

        <!-- operation start -->
        <div class="am-g">
            <button class="am-btn am-btn-primary am-radius am-btn-xs tree-submit-add" data-am-modal="{target: '#data-save-win'}">
                <i class="iconfont icon-btn-add am-show-sm-only"></i>
                <span>{{:MyLang('add_title')}}</span>
            </button>
        </div>
        <!-- operation end -->

        <!-- save win start -->
        <div class="am-popup am-radius" id="data-save-win">
            <div class="am-popup-inner">
                <div class="am-popup-hd">
                    <h4 class="am-popup-title" data-add-title="{{:MyLang('power.base_nav_title')}}{{:MyLang('add_title')}}" data-edit-title="{{:MyLang('power.base_nav_title')}}{{:MyLang('edit_title')}}">{{:MyLang('power.base_nav_title')}}{{:MyLang('add_title')}}</h4>
                    <span data-am-modal-close class="am-close">&times;</span>
                </div>
                <div class="am-popup-bd">
                    <!-- form start -->
                    <form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/power/save')}}" method="POST" request-type="ajax-fun" request-value="TreeFormSaveBack">
                        <div class="am-padding-sm">
                            {{if is_array(MyLang('power.content_top_tips_list'))}}
                                <div class="am-operate-stretch-tips">
                                    <div class="title">
                                        <i class="iconfont icon-tips"></i>
                                        <strong title="{{:MyLang('operate_list_tips_msg')}}">{{:MyLang('operate_list_tips_button_text')}}</strong>
                                        <i class="iconfont icon-contract contract" title="{{:MyLang('operate_list_tips_retract_text')}}"></i> 
                                    </div>
                                    <p>{{:implode('</p><p>', MyLang('power.content_top_tips_list'))}}</p>
                                </div>
                            {{/if}}

                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.power.form_item_name')}}<span class="am-form-group-label-tips-must">*</span></label>
                                <input type="text" placeholder="{{:MyLang('common_service.power.form_item_name_message')}}" name="name" minlength="1" maxlength="60" data-validation-message="{{:MyLang('common_service.power.form_item_name_message')}}" class="am-radius" required />
                            </div>

                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.power.form_item_control')}}</label>
                                <input type="text" placeholder="{{:MyLang('common_service.power.form_item_control_message')}}" name="control" pattern="{{:MyConst('common_regex_control')}}"  data-validation-message="{{:MyLang('common_service.power.form_item_control_message')}}" class="am-radius" />
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.power.form_item_action')}}</label>
                                <input type="text" placeholder="{{:MyLang('common_service.power.form_item_action_message')}}" name="action" pattern="{{:MyConst('common_regex_action')}}"  data-validation-message="{{:MyLang('common_service.power.form_item_action_message')}}" class="am-radius" />
                            </div>

                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.power.form_item_url')}}</label>
                                <input type="text" name="url" placeholder="{{:MyLang('common_service.power.form_item_url_message')}}" data-validation-message="{{:MyLang('common_service.power.form_item_url_message')}}" class="am-radius" />
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.power.form_item_icon')}}{{if is_array(MyLang('common_service.power.form_item_icon_tips_list'))}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:implode('<br />', MyLang('common_service.power.form_item_icon_tips_list'))}}', trigger: 'hover focus', theme: 'sm'}"></a>{{/if}}</label>
                                <input type="text" placeholder="{{:MyLang('common_service.power.form_item_icon_message')}}" name="icon" maxlength="60" data-validation-message="{{:MyLang('common_service.power.form_item_icon_message')}}" class="am-radius" />
                            </div>
                            {{:ModuleInclude('lib/sort', ['is_row'=>1])}}
                            {{:ModuleInclude('lib/is_show', ['is_row'=>1])}}

                            <div class="am-form-popup-submit">
                                <input type="hidden" name="pid" >
                                <input type="hidden" name="id" />
                                <button type="button" class="am-btn am-btn-primary-plain am-radius am-btn-xs btn-loading-example am-margin-right-lg" data-am-modal-close>
                                    <span>{{:MyLang('cancel_title')}}</span>
                                </button>
                                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                                    <span>{{:MyLang('save_title')}}</span>
                                </button>
                            </div>
                        </div>
                    </form>
                    <!-- form end -->
                </div>
            </div>
        </div>
        <!-- save win end -->
        <!-- list start -->
        <div id="tree" class="am-margin-top" data-head='[{"name":"ID","field":"id"},{"name":"权限名称","field":"name","is_arrow":"1","value_style":{"style":"color:#999","value_style_key":"is_show","value_style_key_status":"0"}},{"name":"图标","field":"icon","type":"icon"},{"name":"是否显示","field":"is_show","type":"status"},{"name":"操作","type":"operate"}]' data-node-url="{{:MyUrl('admin/power/getnodeson')}}" data-del-url="{{:MyUrl('admin/power/delete')}}" data-popup-tag="#data-save-win" data-status-url="{{:MyUrl('admin/power/statusupdate')}}" data-rank="3">
            {{:ModuleInclude('public/loading')}}
        </div>
        <!-- list end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{:ModuleInclude('public/footer')}}
<script type="text/javascript">
	// 初始化
	Tree(0, $('#tree').data('node-url'), 0, 1);

	// 回调处理
	function TreeFormSaveBack(e)
	{
		TreeFormSaveBackHandle(e);
	}
</script>